import dataVerificationCtrl from "../controllers/dataVerificationCtrl"
/**
 * 单元格是否在所选区域中
 * @param {*} r 
 * @param {*} c 
 * @param {*} range 
 */
export function checkCellInRange(r, c, range) {
    let isExists = false
    if (range.length > 0) {
        for (let s = 0; s < range.length; s++) {
            let r1 = range[s].row[0], r2 = range[s].row[1];
            let c1 = range[s].column[0], c2 = range[s].column[1];

            if (r >= r1 && r <= r2 && c >= c1 && c <= c2) {
                isExists = true;
                break;
            }
        }
    }
    return isExists
}

/**
 * 2个区域是否重合
 * @param {*} cellList 
 * @param {*} range 
 */

export function checkRangeCrossing(cellList, range) {
    let a = false;
    if (cellList.length > 0) {
        for (let i = 0; i < cellList.length; i++) {
            let res = checkCellInRange(cellList[i].r, cellList[i].c, range)
            if (res) {
                a = res;
                break;
            }
        }
    }
    return a

}

